home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / dos / isfilesystem.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-12  |  2.0 KB  |  88 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: isfilesystem.c,v 1.1 1996/09/11 12:54:46 digulla Exp $
  4.     $Log: isfilesystem.c,v $
  5.     Revision 1.1  1996/09/11 12:54:46  digulla
  6.     A couple of new DOS functions from M. Fleischer
  7.  
  8.     Desc:
  9.     Lang: english
  10. */
  11. #include <clib/exec_protos.h>
  12. #include <dos/dosextens.h>
  13. #include <dos/filesystem.h>
  14. #include "dos_intern.h"
  15.  
  16. /*****************************************************************************
  17.  
  18.     NAME */
  19.     #include <clib/dos_protos.h>
  20.  
  21.     __AROS_LH1(BOOL, IsFileSystem,
  22.  
  23. /*  SYNOPSIS */
  24.     __AROS_LHA(STRPTR, devicename, D1),
  25.  
  26. /*  LOCATION */
  27.     struct DosLibrary *, DOSBase, 118, Dos)
  28.  
  29. /*  FUNCTION
  30.  
  31.     INPUTS
  32.  
  33.     RESULT
  34.  
  35.     NOTES
  36.  
  37.     EXAMPLE
  38.  
  39.     BUGS
  40.  
  41.     SEE ALSO
  42.  
  43.     INTERNALS
  44.  
  45.     HISTORY
  46.     29-10-95    digulla automatically created from
  47.                 dos_lib.fd and clib/dos_protos.h
  48.  
  49. *****************************************************************************/
  50. {
  51.     __AROS_FUNC_INIT
  52.     __AROS_BASE_EXT_DECL(struct DosLibrary *,DOSBase)
  53.  
  54.     /* Get pointer to process structure */
  55.     struct Process *me=(struct Process *)FindTask(NULL);
  56.     struct DosList *dl;
  57.     BOOL success=0;
  58.  
  59.     dl=LockDosList(LDF_DEVICES|LDF_READ);
  60.     dl=FindDosEntry(dl,devicename,LDF_DEVICES);
  61.     if(dl!=NULL)
  62.     {
  63.  
  64.         /* Get pointer to I/O request. Use stackspace for now. */
  65.         struct IOFileSys io,*iofs=&io;
  66.  
  67.         /* Prepare I/O request. */
  68.         iofs->IOFS.io_Message.mn_Node.ln_Type=NT_REPLYMSG;
  69.         iofs->IOFS.io_Message.mn_ReplyPort   =&me->pr_MsgPort;
  70.         iofs->IOFS.io_Message.mn_Length      =sizeof(struct IOFileSys);
  71.         iofs->IOFS.io_Device =dl->dol_Device;
  72.         iofs->IOFS.io_Unit   =dl->dol_Unit;
  73.         iofs->IOFS.io_Command=FSA_IS_FILESYSTEM;
  74.         iofs->IOFS.io_Flags  =0;
  75.  
  76.         /* Send the request. */
  77.         DoIO(&iofs->IOFS);
  78.         
  79.         /* Set return code */
  80.         if(!iofs->io_DosError)
  81.             success=iofs->io_Args[0];
  82.     }
  83.     /* All Done. */
  84.     UnLockDosList(LDF_DEVICES|LDF_READ);
  85.     return success;
  86.     __AROS_FUNC_EXIT
  87. } /* IsFilesystem */
  88.